package zoo.member.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

import zoo.member.dao.MemberDao;
import zoo.member.domain.MemberCommand;
import zoo.member.domain.MemberMilegeCommand;

@Controller
public class MemberMilegeController {

	private String formViewName = "milege";
	private MemberDao memberDao;
	@Autowired
	public void setMemberDao(MemberDao memberDao) {
		this.memberDao = memberDao;
	}
	@RequestMapping(value="/main/milege.do", method=RequestMethod.GET)
	public String process(){
		System.out.println("get");
		return formViewName;
	}
	@ModelAttribute("milegeCommand")
	public MemberMilegeCommand formBacking() {
		return new MemberMilegeCommand();
	}
	@RequestMapping(value="/main/milege.do", method=RequestMethod.POST)
	public ModelAndView submit(@ModelAttribute("milegeCommand") MemberMilegeCommand milegeCommand, BindingResult result,
							   @ModelAttribute("memberCommand")MemberCommand memberCommand){
		
		ModelAndView mav = new ModelAndView();
		mav.setViewName("paymentmilege");
		mav.addObject("mc_chargetxt");
		
		return mav;
	}
}

